package com.audaque.springboot.foshanupload.web.exception;

import com.audaque.springboot.foshanupload.core.enums.ResultCodeEnum;
import lombok.*;
import lombok.EqualsAndHashCode;

@EqualsAndHashCode(callSuper=false)
@Data
@NoArgsConstructor
public class RException extends RuntimeException {

    private String errcode;



    public RException(String message, String errcode) {
        super(message);
        this.errcode = errcode;
    }

    public RException(ResultCodeEnum resultCodeEnum) {
        super(resultCodeEnum.getMsg());
        this.errcode = resultCodeEnum.getCode();
    }

    public RException(ResultCodeEnum resultCodeEnum, String message, Object... args) {
        super(String.format(message, args));
        this.errcode = resultCodeEnum.getCode();
    }

    public RException(String message, Object... args) {
        super(String.format(message, args));
        this.errcode = ResultCodeEnum.FAILE.getCode();
    }


}
